Skip to main content
Version: 6.0.0-beta.3 - 6.0.0-beta.4

ecRecover

Recover the address(es) of the signer(s) from a signed transaction.

Usage

tronWeb.trx.ecRecover(signedTransaction)

Parameter

A signed transaction

Return

Base58 address or array of base58 address.

const pk1 = '...';
const pk2 = '...';
const tx = await tronWeb.transactionBuilder.sendTrx('to', 100);
const signedTransaction = await tronWeb.trx.sign(tx, pk1);

// Recover address of a signed transaction with one signer.
const a = await tronWeb.trx.ecRecover(signedTransaction);
// a === tronWeb.address.fromPrivateKey(pk1);

// Recover addresses of a signed transaction with more than one signer.
const signedTx = await tronWeb.trx.sign(tx, pk2);
const b = await tronWeb.trx.ecRecover(signedTx);
// b is deep equal to [tronWeb.address.fromPrivateKey(pk1), tronWeb.address.fromPrivateKey(pk2)].